home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 3720 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: doc.ic.ac.uk!not-for-mail
  2. From: mdf@doc.ic.ac.uk (Martin Frost)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: x ^= y ^= x ^= y;
  5. Date: 23 Feb 1996 16:47:08 -0000
  6. Organization: Dept. of Computing, Imperial College, University of London, UK.
  7. Distribution: world
  8. Message-ID: <4gkr2c$ica@oak44.doc.ic.ac.uk>
  9. References: <1286.6624T1439T237@cs.ruu.nl>
  10. Reply-To: mdf@doc.ic.ac.uk (Martin Frost)
  11. NNTP-Posting-Host: oak44.doc.ic.ac.uk
  12. X-Newsreader: mxrn 6.18-23
  13.  
  14.  
  15. In article <1286.6624T1439T237@cs.ruu.nl>, wsldanke@cs.ruu.nl (Wessel Dankers) writes:
  16. > a) are these routines efficient for integers? (probably not)
  17.  
  18. I don't see why not. Most compilers I know of treat all values as unsiogned
  19. when using bitwise operations.
  20.  
  21. > b) is this x ^= y ^= x ^= y; method usable with the blitter?
  22. >    It would be possible to swap two memory locations with no
  23. >    extra memory required in three Blit calls. Is the blitter
  24. >    equally fast with copying as with XOR'ing?
  25.  
  26. It works, but is not very fast. The blitter takes 4 cycles for a copy and
  27. 6 for a 2 source operation like XOR. Best is to use a temporary buffer for
  28. one line only and swap the data a line at a time. This is quite efficient
  29. in terms of memory, and the modulo registers can be precalculated beforehand,
  30. so there is very little overhead.
  31.  
  32. Martin
  33.